<div class="breadcrumbs" id="breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="{{ url('dashboard/index') }}">控制面板</a>
        </li>
        <li>
            <a href="javascript:void(0);">站点设置</a>
        </li>
    </ul>
</div>
<div class="page-content">
    <div class="page-header">
        <h1>
            站点设置
            <small>
                <i class="icon-double-angle-right"></i>
                基本设置
            </small>
        </h1>
    </div>
    <div class="col-lg-12">
        <form action="{{url('options/savebase')}}" method="post" class="form-horizontal" id="base-options-form">
            <div class="form-group">
                <label for="site-name" class="col-sm-2 control-label">站点名称</label>
                <div class="col-sm-8">
                    <input type="text" name="siteName" value="{% if options is not empty %}{{options['site_name']['op_value']}}{% endif %}"
                           class="form-control" id="site-name" placeholder="请填写站点名称">
                    <span class="form-tips">站点名称由中英文字符、数字、下划线和横杠组成</span>
                </div>
            </div>
            <div class="form-group">
                <label for="site-title" class="col-sm-2 control-label">站点标题</label>
                <div class="col-sm-8">
                    <input type="text" name="siteTitle" value="{% if options is not empty %}{{options['site_title']['op_value']}}{% endif %}"
                           class="form-control" id="site-title" placeholder="请填写站点标题">
                    <span class="form-tips">在前台页面中，站点标题展现在站点名称旁边</span>
                </div>
            </div>
            <div class="form-group ">
                <label for="site-url" class="col-sm-2 control-label">站点地址</label>
                <div class="col-sm-8">
                    <input type="text" name="siteUrl" value="{% if options is not empty %}{{options['site_url']['op_value']}}{% endif %}"
                           class="form-control" id="site-url" placeholder="http://">
                </div>
            </div>
            <div class="form-group ">
                <label for="cdn-url" class="col-sm-2 control-label">CDN地址</label>
                <div class="col-sm-8">
                    <input type="text" name="cdnUrl" value="{% if options is not empty %}{{options['cdn_url']['op_value']}}{% endif %}"
                           class="form-control" id="cdn-url" placeholder="http://">
                    <span class="form-tips">静态资源加速地址。若为空，则为站点地址</span>
                </div>
            </div>
            <div class="form-group">
                <label for="site-keywords" class="col-sm-2 control-label">关键词</label>
                <div class="col-sm-8">
                    <input type="text" name="keywords" value="{% if options is not empty %}{{options['site_keywords']['op_value']}}{% endif %}"
                           class="form-control" id="site-keywords" placeholder="请填写站点关键词" />
                    <span class="form-tips">用于SEO。多个关键字间用逗号","分隔</span>
                </div>
            </div>
            <div class="form-group">
                <label for="site-description" class="col-sm-2 control-label">站点描述</label>
                <div class="col-sm-8">
                    <input type="text" name="description" value="{% if options is not empty %}{{options['site_description']['op_value']}}{% endif %}"
                           class="form-control" id="site-description" placeholder="请填写站点描述" />
                    <span class="form-tips">用于SEO</span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-5">
                    <button type="submit" id="base-options-btn" class="btn btn-info btn-sm">保存设置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $('#base-options-btn').on('click', function(){
        var siteName = $.trim($('#site-name').val());
        var siteNamePattern = /^[\u4e00-\u9fa5\w-]+$/i;
        if(!siteNamePattern.test(siteName)){
            tips_message('站点名称由中英文字符、数字、下划线和横杠组成');
            return false;
        }

        $('#base-options-form').submit();
    });
</script>